(function () {
    'use strict';

    angular
        .module('SURF')
        .controller('LeftController', LeftController);

    LeftController.$inject = ['$scope', '$location', 'CookieStoreService', 'COOKIE_STORE_KEYS', '$translate'];

    function LeftController($scope, $location, CookieStoreService, COOKIE_STORE_KEYS,$translate) {
        angular.element(window).bind('load', function() {
            var lang = window.localStorage.lang || 'zh';
            $translate.use(lang);
        });
        $scope.hasPermission = hasPermission;
        $scope.cName = CookieStoreService.getValue(COOKIE_STORE_KEYS.USER_NAME);

        $scope.$on("refreshLeftMenu", function (event, data) {

            hasPermission();
        });



        $(".active").removeClass("active");
        $("#"+classId).addClass("active");
        $("#"+classChiId).addClass("active");
        document.getElementById('userName').innerHTML = userName;

        function hasPermission(role1) {
            if (CookieStoreService.getValue(COOKIE_STORE_KEYS.ROLE) != undefined) {
                if(CookieStoreService.getValue(COOKIE_STORE_KEYS.ROLE) == role1){
                    return true;
                }
            }
            return false;
        }

    }
})();
